import React,{ useState } from "react"
// 函数组件
function Hello(props) {
  // console.log(props);
  return (
    <>
      <h3>我是子组件---{props.value}</h3>
    </>
  )
}
// 类组件
class Footer extends React.Component {
  render() {
    console.log(this.props);
    return (
      <>
        <h3>我是类组件-子组件---{this.props.age}---{this.props.count}</h3>
      </>
    )
  }
}
function App() {
  const [value, setValue] = useState(100)
  return (
    <>
    <Hello name="鲁班" value={value} />
    <button onClick={() => setValue(value+1)}>父组件修改value</button>
    <Footer age="20" count={value} />
  </>
)
}
import React, { useState } from 'react';
import Hello from './path/to/Hello'; // Make sure to replace with the correct path to the Hello component
import Footer from './path/to/Footer'; // Make sure to replace with the correct path to the Footer component

function App() {
  const [value, setValue] = useState(100);
  return (
    <>
      <Hello name="鲁班" value={value} />
      <button onClick={() => setValue(value+1)}>父组件修改value</button>
      <Footer age="20" count={value} />
    </>
  );
}
export default App